<?xml version='1.0' encoding='utf-8'?>
{% extends "ticket/modify.html" %}

{% block content_ticket %}
<fieldset id="fieldset_general" class="inline form">
  <legend>Général</legend>
  <div>{{ form.state.label_tag }} {{ form.state }}</div>
</fieldset>
<fieldset class="block form">
  <legend>Contact</legend>
  <table>
    <tr>
        <td class="large">{{ form.client.label_tag }}</td><td>{{ form.client }}</td>
        <td class="large right"><strong>Assigné à</strong></td><td>{{ form.instance.assigned_to|default:"" }}</td>
    </tr>
    <tr>
        <td class="large">{{ form.contact.label_tag }}</td><td>{{ form.contact }}</td>
        <td class="large right"><label for="id_opened_by">Ouvert par</label></td><td>{{ form.instance.opened_by }} le {{ form.instance.date_open|date:"d/m/Y à H:i" }}</td>
    </tr>
    <tr>
        <td class="large">{{ form.telephone.label_tag }}</td><td>{{ form.telephone }}</td>
        <td class="large right"><label for="id_last_modification">Dernière modif.</label></td><td>le {{ form.instance.last_modification|date:"d/m/Y à H:i" }}</td>
    </tr>
    <tr>
        <td class="large">&nbsp;</td><td></td>
        <td class="large right">
        {% if form.instance.validated_by %}
            <strong>Validé par</strong></td><td>{{ form.instance.validated_by|default:"" }}</td>
        {% else %}
            {% if perms.ticket.can_validate_ticket %}
                <td colspan="2"><button type="submit" dojoType="dijit.form.Button" name="_validate-ticket" value="Valider ce ticket">Valider ce ticket</button></td>
            {% endif %}
        {% endif %}</td>
    </tr>
  </table>
</fieldset>

<fieldset class="block form">
  <legend>Contenu</legend>
  <p><label for="id_title">Titre</label> {{ form.title }}</p>
  <p>{{ form.text }}</p>
</fieldset>
<fieldset class="block form">
    <legend>Fichiers joint</legend>
    <table>
        {% for file in form.instance.ticketfile_set.all %}
        <tr>
            <td><a href="{% url ticket_get_file file.pk %}">{{ file.filename }}</a></td>
        </tr>
        {% endfor %}
        <tr>
            <td>{{ form.file }}</td>
        </tr>
    </table>
</fieldset>
<hr />

{% with form as form_to_comment %}
<fieldset class="block form" style="padding: 0;">
  <legend>Réponses</legend>
{% include "ticket/comment.html" %}
</fieldset>
{% endwith %}

{% endblock content_ticket %}

{% block content_childs %}
<div id="div_childs" class="childs">
{{ child_formset.management_form }}
{% for cf in child_formset.forms %}
{% include "ticket/child_small.html" %}
{% endfor %}
</div>
{% endblock content_childs %}

